require_not_empty

function <T> require_not_empty(value: list<T>?, message: text): list<T>

Asserts that a list is non-null and non-empty.

Return

the passed value, but with type cast from list<T>? to list<T>

Since

0.9.0

Parameters

value

the list to be checked.

message

the message for the exception to be thrown if the list is null or empty

Throws

exception

if the provided list is null or empty


function <T: -immutable> require_not_empty(value: set<T>?, message: text): set<T>

Asserts that a set is non-null and non-empty.

Return

the passed value, but with type cast from set<T>? to set<T>

Since

0.9.0

Parameters

value

the set to be checked

message

the message for the exception to be thrown if the set is null or empty

Throws

exception

if the provided set is null or empty


function <K: -immutable, V> require_not_empty(value: map<K, V>?, message: text): map<K, V>

Asserts that a map is non-null and non-empty.

Return

the passed value, but with type cast from map<K,V>? to map<K,V>

Since

0.9.0

Parameters

value

the map to be checked

message

the message for the exception to be thrown if the map is null or empty

Throws

exception

if the provided map is null or empty


function <T: -any> require_not_empty(value: T?, message: text): T

Asserts that a value is non-null.

Return

the passed value, but with type cast from T? to T

Since

0.9.0

Parameters

value

the nullable value to be checked

message

the message for the exception to be thrown if the value is null

Throws

exception

if the provided value is null